// createWebHashHistory 是hash模式就是访问链接带有#
// createWebHistory  是history模式
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'

// 引入文件，动态路由
const Home = () => import("../views/Home.vue");
const About = () => import("../views/About.vue");
const Warning = () => import("../views/Warning.vue");
const Error = () => import("../views/Error.vue");
// const NotFound = () => import("../renderer/NotFound.vue");

// 这里要注意一点，如下面这种写的话会报错，ts
// {
//    path: "/",
//    name: "Home",
//    component: () => import("../views/Home.vue")
//  },


const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/About",
    name: "About",
    component: About,
  },
  {
    path: "/Warning",
    name: "Warning",
    component: Warning,
  },
  {
    path: "/Error",
    name: "Error",
    component: Error,
  },
  // {
  //   path: "/:pathMatch(.*)*", // 代替vue2的通配符path: "*",
  //   name: "NotFound",
  //   component: NotFound,
  // },
];

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router
